<template>
	<view class="">
		<navgetbar title="商家资质"></navgetbar>
	</view>
	<view class="imgcss">
		<view class="imgs">
			商家资质信息公示
		</view>
		<up-image :src="url" width="324rpx" height="200rpx" @click="previewImg([url])"></up-image>
		<view class="mt-[30rpx]" v-if="store.doorinfo.otherDocuments!==null && store.doorinfo.otherDocuments.length>0">
			<view class="imgs">
				其他资质
			</view>
			<view class="flex overflow-x-scroll">
				<view class="mr-[20rpx]" v-for="(item,index) in store.doorinfo.otherDocuments">
					<up-image :src="item" width="324rpx" height="200rpx" @click="previewImg(store.doorinfo.otherDocuments,index)"></up-image>
				</view>
			</view>
	
			
		</view>

	</view>
</template>

<script setup>
	import navgetbar from "@/components/navgetbar/navindex.vue"
	import {
		ref,
		onMounted
	} from "vue"
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import {
		useStore
	} from '@/stores/user.js'
	const store = useStore();
	import {
		storeToRefs
	} from 'pinia'
	let {
		userInfo,
		doorinfo
	} = storeToRefs(store);
	const url = ref("")
	//预览图片
	const previewImg = (imgUrlList, index) => {
		console.log(imgUrlList, index)
		let imgsArray = [];
		for (let i = 0; i < imgUrlList.length; i++) {
			if (imgUrlList[i].videoUrl == "") {
				imgsArray.push(imgUrlList[i].imgUrl);
			}
		}
		uni.previewImage({
			current: index,
			urls: imgUrlList,
			longPressActions: {
				// itemList: ['发送给朋友', '保存图片', '收藏'],
				success: function(data) {
					//console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
				},
				fail: function(err) {
					console.log(err.errMsg);
				}
			}
		});
	}
	onMounted(() => {
		url.value = store.doorinfo.businessLicense

	})
</script>

<style lang="scss" scoped>
	.imgcss {
		background: #FFFFFF;
		border-radius: 20rpx;
		margin: 20rpx;
		padding:30rpx 20rpx;

		.imgs {
			margin-bottom: 15rpx;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			line-height: 30rpx;
			color: #1A1B1C;
		}
	}
</style>